package day8.homeworkII.Task6;

public class Card implements Comparable<Card>{
    private String Color;
    private String Values;
    private Integer Order;

    public Card(String color, String values) {
        Color = color;
        Values = values;
    }

    public Card(String color, String values, Integer order) {
        Color = color;
        Values = values;
        Order = order;
    }

    public Card() {

    }

    @Override
    public String toString() {
        return " " + Color + Values;
    }

    public String getColor() {
        return Color;
    }

    public void setColor(String color) {
        Color = color;
    }

    public String getValues() {
        return Values;
    }

    public void setValues(String values) {
        Values = values;
    }

    public Integer getOrder() {
        return Order;
    }

    public void setOrder(Integer order) {
        Order = order;
    }


    @Override
    public int compareTo(Card o) {
        float f = this.Color == "方块" ? (float) 0.1 : 0;
        f += this.Color == "梅花" ? (float) 0.2 : 0;
        f += this.Color == "红桃" ? (float) 0.3 : 0;
        f += this.Color == "黑桃" ? (float) 0.5 : 0;
        float f2 = o.Color == "方块" ? (float) 0.1 : 0;
        f2 += o.Color == "梅花" ? (float) 0.2 : 0;
        f2 += o.Color == "红桃" ? (float) 0.3 : 0;
        f2 += o.Color == "黑桃" ? (float) 0.5 : 0;
        return (int)((this.getOrder() - o.getOrder() + f -  f2) * 10);
    }
}
